package cn.easy.controller;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;



/**
 * @author 张澎_9970
 * @date 2021.12.14 下午 8:16 星期二
 * @desc:
 */
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @GetMapping("{id}")
    public String findById(@PathVariable Integer id) throws InterruptedException {
        System.out.println("下单成功");
        Thread.sleep(300);
        rabbitTemplate.convertAndSend("Boot_Topic_Exchange","order.insert","Boot_insert");
        rabbitTemplate.convertAndSend("Boot_Topic_Exchange","order.delete","Boot_delete");
        return "Success";
    }
}
